struct DXToVertex
{
   float4 Position	:POSITION;
   float4 Normal	:NORMAL;
   float2 Texture0	:TEXCOORD0;   
};

struct VertexToPixel
{
    float4 Position     :POSITION;  
	float3 Normal	:TEXCOORD0; 
	float4 Pos		:TEXCOORD1; 
    float2 Texture0	:TEXCOORD2;             
};

struct PixelToFrame
{
	
};

Texture tankTex;

float4x4 xWorldViewProj;
float4x4 xRotation;

float4 xMaterialAmbient;
float4 xMaterialDiffuse;
float4 xMaterialSpecular;
float4 xMaterialEmissive;

float4 xLight;
float4 xLightPos;
float4 xLightAmbient;
float4 xLightDiffuse;
float4 xLightSpecular;

sampler tanktexSampler = sampler_state 
{
	texture = <tankTex> ; 
	magfilter = LINEAR; 
	minfilter = LINEAR; 
	mipfilter=LINEAR; 
	//AddressU = mirror; 
	//AddressV = mirror;
};


VertexToPixel SimplestVertexShader( DXToVertex In)
{
    VertexToPixel Output = (VertexToPixel)0;
	
    Output.Position =  mul(float4(In.Position.xyz,1.0f), xWorldViewProj);
    Output.Texture0 = In.Texture0; 
	Output.Normal = mul(float4(In.Normal.xyz,1.0f), xRotation);

	Output.Pos = float4(In.Position.xyz,1.0f);
    
    return Output;    
}

float4 SimplestPixelShader(VertexToPixel In) :COLOR0
{      

	float4 PointLight = normalize(xLightPos-In.Pos);
    float4 xTotalLightDiffuse =  xLightDiffuse*dot(float4(In.Normal.xyz,1),PointLight);

    float4 rtrn = tex2D( tanktexSampler, In.Texture0.xy );
    rtrn *= xTotalLightDiffuse * xMaterialDiffuse;
	return rtrn;
}

technique Simple
{
    pass Pass0
    {        
	AlphaBlendEnable = false;
	ZWriteEnable = true;  
	CullMode = CCW;

        VertexShader = compile vs_1_1 SimplestVertexShader();
        PixelShader = compile ps_2_0 SimplestPixelShader();
    }
}